package br.edu.ufersa.scrumgame.modelo;

import javax.persistence.*;

@Entity
@NamedQueries( {
	@NamedQuery(name = "Nivel.findByExperiencia", query = "select u from Nivel u where :experiencia between u.experienciaInicio and u.experienciaFim")
})
public class Nivel {
	
	@Id
	private int id;
	
	private String descricao;
	
	private int experienciaInicio;
	
	private int experienciaFim;
	
	private int maxEnergia;
	
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getDescricao() {
		return descricao;
	}

	public void setDescricao(String descricao) {
		this.descricao = descricao;
	}

	public int getExperienciaInicio() {
		return experienciaInicio;
	}

	public void setExperienciaInicio(int experienciaInicio) {
		this.experienciaInicio = experienciaInicio;
	}

	public int getExperienciaFim() {
		return experienciaFim;
	}

	public void setExperienciaFim(int experienciaFim) {
		this.experienciaFim = experienciaFim;
	}

	public int getMaxEnergia() {
		return maxEnergia;
	}

	public void setMaxEnergia(int maxEnergia) {
		this.maxEnergia = maxEnergia;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((descricao == null) ? 0 : descricao.hashCode());
		result = prime * result + experienciaFim;
		result = prime * result + experienciaInicio;
		result = prime * result + id;
		result = prime * result + maxEnergia;
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Nivel other = (Nivel) obj;
		if (descricao == null) {
			if (other.descricao != null)
				return false;
		} else if (!descricao.equals(other.descricao))
			return false;
		if (experienciaFim != other.experienciaFim)
			return false;
		if (experienciaInicio != other.experienciaInicio)
			return false;
		if (id != other.id)
			return false;
		if (maxEnergia != other.maxEnergia)
			return false;
		return true;
	}

}
